﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;

namespace swaganomics.Backend
{
    public class VariousFunctions
    {
        /// <summary>
        /// Gets the parent directory of the application's exe
        /// </summary>
        public static string ApplicationLocation()
        {
            return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\";
        }

        public static char[] DisallowedPluginChars = new char[] { ' ', '>', '<', ':', '-', '_', '/', '\\', '&', ';', '!', '?', '|', '*', '"' };
        /// <summary>
        /// Remove disallowed chars from the game name
        /// </summary>
        /// <param name="gameName">Game Name from the XML file</param>
        public static string SteralizeGamePluginFolder(string gameName)
        {
            foreach(char disallowed in DisallowedPluginChars)
                gameName = gameName.Replace(disallowed.ToString(), "");

            return gameName;
        }
    }
}
